using Aurora.TaskScheduler.Abstractions.BaseModel;
using Aurora.TaskScheduler.Abstractions.Storage;
using Microsoft.Extensions.DependencyInjection;

namespace Aurora.TaskScheduler.Storage.MySql;

public class MySqlTaskSchedulerOptionExtension : ITaskScheduleOptionsExtension
{
    private readonly Action<MySqlOptions> _configure;

    public MySqlTaskSchedulerOptionExtension(Action<MySqlOptions> configure)
    {
        _configure = configure;
    }

    public void AddServices(IServiceCollection services)
    {
        services.AddSingleton<MySqlSugarContext>();
        services.AddScoped<IDataStorage, MysqlDataStorage>();
        services.Configure(_configure);
    }
}